﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Collections.Generic;
using DTO;

namespace TVC_WEB.Global.UserControl
{
    public partial class ucTopMenu : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["cart"] != null)
            {
                List<DTO.CartInfo> lcart = Session["cart"] as List<DTO.CartInfo>;

                if (lcart.Count > 0)
                    lkCart.Text = "View Basket (" + lcart.Count + ")";
                else lkCart.Text = "View Basket";
            }
            else lkCart.Text = "View Basket";

            if (Session["Username"] == null || Session["Username"].ToString() == "")
            {
                newuser.Attributes["style"] = "display:";
                existuser.Attributes["style"] = "display:none";
            }
            else
            {
                newuser.Attributes["style"] = "display:none";
                existuser.Attributes["style"] = "display:";
            }



        }

        protected void lkCart_Click(object sender, EventArgs e)
        {
            if (Session["cart"] != null)
            {
                List<CartInfo> lcart = Session["cart"] as List<CartInfo>;
                if (lcart.Count > 0)
                {
                    Response.Redirect("cart.aspx");
                }
            }
        }
    }
}